<template>
  <div class="detail_instructions">
    <h3 class="detail_instructions-title app">{{title}}</h3>
    <el-image class="detail_instructions-image" :src="utils.setCdnUrl() + image"></el-image>
    <div class="detail_instructions-content">
      <h3 class="detail_instructions-title">{{title}}</h3>
      <p class="detail_instructions-tip">说明书内容</p>
      <div class="detail_instructions-item" v-for="item in data" :key="item.url">
        <div class="detail_instructions-text">
          <i class="iconfont icon-Manual left-icon"></i>
          <span @click="handleDownload(item)">{{item.name}}</span>
        </div>
        <div class="action">
          <a target="_blank" :href="utils.setCdnUrl() + item.url"><i class="iconfont icon-Details"></i></a>
          <span style="margin-left: 16px;" @click="handleDownload(item)"><i class="iconfont icon-Download1"></i></span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    image: String,
    data: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    handleDownload(item) {
      window.open('/api/front/product/down_load?file_url=' + item.url)
    }
  }
}
</script>

<style lang="scss" scoped>
  .detail_instructions {
    display: flex;
    background: #FFFFFF;
    width: 100%;
    width: 1200px;
    margin: 56px auto 0;
    padding-top: 136px;
    padding-bottom: 40px;
    // height: 100%;
  }
  .detail_instructions-image {
    flex-shrink: 0;
    width: 320px;
    height: 320px;
    margin: 0 auto;
  }
  .detail_instructions-content {
    flex: 1;
    padding-left: 40px;
    width: 980px;
  }
  .detail_instructions-title.app {
    display: none;
  }
  .detail_instructions-title {
    font-size: 32px;
    color: #191919;
  }
  .detail_instructions-tip {
    font-size: 16px;
    color: #191919;
    margin: 40px 0 16px;
  }
  .detail_instructions-item {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;

    .left-icon {
      margin-right: 16px;
    }
    .detail_instructions-text {
      // max-width: 708px;
      max-width: 90%;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      
      span {
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      
      &:hover {
        i {
          color: #6C7E59;
        }
        color: #6C7E59;
      }
    }

    .action i{
      cursor: pointer;
      color: #2697FF;

      &:hover {
        color: #1d86d4;
      }
    }
  }
  @media screen and (max-width: 768px) {
    .detail_instructions {
      width: 100%;
      flex-direction: column;
      padding: 136px 20px 40px;
      margin-top: 0;
    }
    .detail_instructions-title {
      font-size: 20px;
      margin-bottom: 16px;
      margin-top: 20px;
      line-height: 1.4em;
      text-align: center;
    }
    .detail_instructions-image {
      width: 168px;
      height: 168px;
    }
    .detail_instructions-title.app {
      display: block;
    }
    
    .detail_instructions-content {
      width: 100%;
      padding-left: 0;
      .detail_instructions-text {
        max-width: 80%;
      }
      .detail_instructions-title {
        display: none;
      }
      .detail_instructions-tip {
        text-align: center;
        font-size: 16px;
        font-weight: bold;
        margin: 24px 0 16px;
      }
    }
  }
</style>